package com.demo.springBootDemo02;

import java.util.HashMap;
import java.util.Map;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;

@SpringBootApplication
public class SpringBootDemoApplication extends SpringBootServletInitializer {

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		application.sources(SpringBootDemoApplication.class);
		
		// 添加运行时外部属性的方式,比如从远程配置中心获取属性
		Map<String, Object> defaultProperties = new HashMap<String, Object>();
		defaultProperties.put("runtime_ftpIp", "192.168.10.10");
		defaultProperties.put("runtime_ftpUsername", "ftpUsername");
		defaultProperties.put("runtime_ftpPassword", "ftpPassword");
		application.properties(defaultProperties);
		
		return application;
	}

	public static void main(String[] args) {
		SpringApplication application = new SpringApplication(SpringBootDemoApplication.class);
		// 添加运行时外部属性的方式,比如从远程配置中心获取属性
		Map<String, Object> defaultProperties = new HashMap<String, Object>();
		defaultProperties.put("runtime_ftpIp", "192.168.10.10");
		defaultProperties.put("runtime_ftpUsername", "ftpUsername");
		defaultProperties.put("runtime_ftpPassword", "ftpPassword");
		application.setDefaultProperties(defaultProperties);
		application.run(args);
	}

}
